<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Tomcat 监控指南 - 确保应用健康与高性能</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        /* Hero Section Styles */
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            position: relative;
            overflow: hidden;
        }
        
        .hero-pattern {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
        }
        
        /* Typography */
        .serif-title {
            font-family: 'Noto Serif SC', serif;
            letter-spacing: 0.05em;
        }
        
        /* Card Hover Effects */
        .card-hover {
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        
        .card-hover:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        
        /* Code Block Styles */
        .code-block {
            background: #1e293b;
            color: #e2e8f0;
            border-radius: 0.75rem;
            position: relative;
            overflow: hidden;
        }
        
        .code-block::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
        }
        
        /* Section Divider */
        .section-divider {
            height: 2px;
            background: linear-gradient(90deg, transparent, #667eea, #764ba2, transparent);
            margin: 3rem 0;
        }
        
        /* Metric Card */
        .metric-card {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 1rem;
            padding: 1.5rem;
            position: relative;
            overflow: hidden;
        }
        
        .metric-card::after {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
            transform: rotate(45deg);
        }
        
        /* Tool Badge */
        .tool-badge {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 0.5rem 1rem;
            border-radius: 2rem;
            font-weight: 500;
            display: inline-block;
            margin: 0.25rem;
            transition: transform 0.2s;
        }
        
        .tool-badge:hover {
            transform: scale(1.05);
        }
        
        /* Mermaid Diagram Container */
        .mermaid-container {
            background: white;
            border-radius: 1rem;
            padding: 2rem;
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 relative">
        <div class="hero-pattern"></div>
        <div class="container mx-auto px-6 relative z-10">
            <div class="max-w-4xl mx-auto text-center">
                <h1 class="serif-title text-5xl md:text-6xl font-bold mb-6 leading-tight">
                    <i class="fas fa-server mr-4"></i>Tomcat 监控指南
                </h1>
                <p class="text-xl md:text-2xl mb-8 opacity-90">
                    确保应用健康性与高性能的专业实践
                </p>
                <div class="flex flex-wrap justify-center gap-4">
                    <div class="bg-white bg-opacity-20 backdrop-blur-sm rounded-full px-6 py-3">
                        <i class="fas fa-heartbeat mr-2"></i>健康监控
                    </div>
                    <div class="bg-white bg-opacity-20 backdrop-blur-sm rounded-full px-6 py-3">
                        <i class="fas fa-tachometer-alt mr-2"></i>性能优化
                    </div>
                    <div class="bg-white bg-opacity-20 backdrop-blur-sm rounded-full px-6 py-3">
                        <i class="fas fa-shield-alt mr-2"></i>高可用保障
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Introduction -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto">
                <p class="text-lg leading-relaxed text-gray-700 indent-8">
                    监控 Tomcat 的运行状态对于确保应用的健康性和性能至关重要。有效的监控可以帮助识别潜在问题、优化性能、确保高可用性。本指南将为您详细介绍 Tomcat 监控的最佳实践和工具选择。
                </p>
            </div>
        </div>
    </section>

    <!-- Monitoring Architecture Diagram -->
    <section class="py-16 bg-gray-50">
        <div class="container mx-auto px-6">
            <div class="max-w-6xl mx-auto">
                <h2 class="serif-title text-3xl font-bold text-center mb-12 text-gray-800">
                    <i class="fas fa-sitemap mr-3 text-purple-600"></i>Tomcat 监控架构全景
                </h2>
                <div class="mermaid-container">
                    <div class="mermaid">
                        graph TB
                            A[Tomcat Server] --> B[JMX]
                            A --> C[Manager App]
                            A --> D[日志输出]
                            
                            B --> E[JConsole]
                            B --> F[VisualVM]
                            B --> G[Prometheus JMX Exporter]
                            
                            C --> H[Web界面监控]
                            
                            D --> I[ELK Stack]
                            D --> J[Fluentd]
                            
                            G --> K[Prometheus]
                            K --> L[Grafana]
                            
                            I --> M[Kibana Dashboard]
                            
                            N[Datadog Agent] --> A
                            O[New Relic Agent] --> A
                            P[Zabbix Agent] --> A
                            
                            style A fill:#667eea,stroke:#764ba2,stroke-width:3px,color:#fff
                            style L fill:#f093fb,stroke:#f5576c,stroke-width:2px,color:#fff
                            style M fill:#f093fb,stroke:#f5576c,stroke-width:2px,color:#fff
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Monitoring Methods -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-6">
            <div class="max-w-6xl mx-auto">
                <h2 class="serif-title text-4xl font-bold mb-12 text-gray-800">
                    <i class="fas fa-tools mr-3 text-purple-600"></i>监控 Tomcat 运行状态的方法
                </h2>
                
                <!-- JMX Configuration -->
                <div class="mb-12">
                    <h3 class="text-2xl font-bold mb-6 text-gray-700">
                        <i class="fas fa-cog mr-2 text-purple-500"></i>1.1 使用 JMX（Java Management Extensions）
                    </h3>
                    <div class="bg-gray-50 rounded-xl p-6 mb-6">
                        <p class="text-gray-700 mb-4 leading-relaxed">
                            Tomcat 内置了对 JMX 的支持，通过 JMX，你可以访问 Tomcat 的各种管理和监控信息。可以通过 JConsole、VisualVM 等工具连接到 Tomcat 的 JMX 端口，实时监控其状态。
                        </p>
                    </div>
                    
                    <div class="code-block p-6 mb-6">
                        <div class="flex items-center mb-4">
                            <i class="fas fa-terminal mr-2 text-purple-400"></i>
                            <span class="text-sm font-semibold text-gray-300">配置 JMX</span>
                        </div>
                        <pre class="text-sm overflow-x-auto"><code>JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=1099"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"</code></pre>
                    </div>
                    
                    <div class="bg-blue-50 border-l-4 border-blue-500 p-4 rounded">
                        <p class="text-gray-700">
                            <i class="fas fa-info-circle mr-2 text-blue-500"></i>
                            在 Tomcat 的 <code class="bg-blue-100 px-2 py-1 rounded">catalina.sh</code> 或 <code class="bg-blue-100 px-2 py-1 rounded">catalina.bat</code> 文件中配置 JMX 相关的 JVM 参数。
                        </p>
                    </div>
                </div>
                
                <!-- Tomcat Manager App -->
                <div class="mb-12">
                    <h3 class="text-2xl font-bold mb-6 text-gray-700">
                        <i class="fas fa-desktop mr-2 text-purple-500"></i>1.2 使用 Tomcat Manager App
                    </h3>
                    <div class="grid md:grid-cols-2 gap-6">
                        <div class="bg-gradient-to-br from-purple-50 to-pink-50 rounded-xl p-6">
                            <h4 class="font-bold mb-3 text-gray-800">功能特点</h4>
                            <p class="text-gray-700 leading-relaxed">
                                Tomcat 的 Manager 应用提供了一个基于 Web 的界面来监控和管理 Tomcat。你可以通过这个界面查看应用的状态、内存使用情况、请求统计信息等。
                            </p>
                        </div>
                        <div class="bg-gradient-to-br from-blue-50 to-green-50 rounded-xl p-6">
                            <h4 class="font-bold mb-3 text-gray-800">访问方式</h4>
                            <p class="text-gray-700">
                                默认情况下，可以通过以下地址访问：
                            </p>
                            <code class="block mt-2 bg-white px-4 py-2 rounded text-sm">http://localhost:8080/manager/html</code>
                        </div>
                    </div>
                </div>
                
                <!-- Integration Tools -->
                <div class="mb-12">
                    <h3 class="text-2xl font-bold mb-6 text-gray-700">
                        <i class="fas fa-plug mr-2 text-purple-500"></i>1.3 集成监控工具
                    </h3>
                    <p class="text-gray-700 mb-6 leading-relaxed">
                        集成第三方监控工具可以更全面地监控 Tomcat 的状态。以下是一些常用的工具：
                    </p>
                    <div class="flex flex-wrap gap-3">
                        <span class="tool-badge"><i class="fas fa-chart-line mr-2"></i>Prometheus + Grafana</span>
                        <span class="tool-badge"><i class="fas fa-layer-group mr-2"></i>Elastic Stack (ELK)</span>
                        <span class="tool-badge"><i class="fas fa-dog mr-2"></i>Datadog</span>
                        <span class="tool-